//testLog4.js
var log4js = require('log4js');
//logger 是log4js的实例
// var logger = log4js.getLogger();
// logger.level = "trace"
// logger.trace('this is trace');
// logger.debug('this is debug');
// logger.info('this is info');
// logger.warn('this is warn');
// logger.error('this is error');
// logger.fatal('this is fatal');
var log4js = require("log4js");


log4js.configure({
    appenders: {
        xcLogFile: {
            type: "dateFile",
            filename: './logs/xcLogFile',//您要写入日志文件的路径
            alwaysIncludePattern: true,//（默认为false） - 将模式包含在当前日志文件的名称以及备份中
            //compress: true,//（默认为false） - 在滚动期间压缩备份文件（备份文件将具有.gz扩展名）
            pattern: "-yyyy-MM-dd-hh.log",//（可选，默认为.yyyy-MM-dd） - 用于确定何时滚动日志的模式。格式:.yyyy-MM-dd-hh:mm:ss.log
            encoding: 'utf-8',//default "utf-8"，文件的编码
            maxLogSize: 10 //文件最大存储空间，当文件内容超过文件存储空间会自动生成一个文件xxx.log.1的序列自增长的文件
        },
        xcLogConsole: {
            type: 'console'
        }
    },
    categories: {
        default: {
            appenders: ['xcLogFile'],
            level: 'all'
        },
        xcLogFile: {
            appenders: ['xcLogFile'],
            level: 'all'
        },
        xcLogConsole: {
            appenders: ['xcLogConsole'],
            level: log4js.levels.ALL
        }
    }
});
var logger = log4js.getLogger();
logger.level = "info"
logger.info('this is info');

"curl \"https://www.baidu.com/sugrec?prod=pc_his^&from=pc_web^&json=1^&sid=1425_21081_30211_26350^&req=2^&sc=eb^&csor=0\" -H \"Sec-Fetch-Mode: cors\" -H \"Sec-Fetch-Site: same-origin\" -H \"Accept-Encoding: gzip, deflate, br\" -H \"Accept-Language: zh-CN,zh;q=0.9\" -H \"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36\" -H \"Accept: application/json, text/javascript, */*; q=0.01\" -H \"Referer: https://www.baidu.com/\" -H \"Cookie: BAIDUID=DAA5BB3DF2E38D948370BA5B27019EEE:FG=1; BIDUPSID=DAA5BB3DF2E38D948370BA5B27019EEE; PSTM=1566733603; BDUSS=EtEZzVONUhyZnJPSW5hfm9SbHNySUtPOG02cTFhVHZNNHJNYXlqfnFBa1Y3Z0ZlSVFBQUFBJCQAAAAAAAAAAAEAAABAul4016Wyu9ehtcS72NLkMDkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABVh2l0VYdpdN; BD_UPN=12314753; BDORZ=B490B5EBF6F3CD402E515D22BCDA1598; COOKIE_SESSION=1720335_0_9_9_1_16_0_0_9_7_1_0_0_0_0_0_1567435178_0_1576317918^%^7C9^%^230_0_1576317918^%^7C1; BD_HOME=1; H_PS_PSSID=1425_21081_30211_26350; sugstore=0\" -H \"Connection: keep-alive\" --compressed"
